package com.kgc.crowd.distributioncrowdwebui.config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

import java.io.FileWriter;
import java.io.IOException;

@Configuration
public class AlipayConfig implements InitializingBean {
    @Value("${appId}")
    private String appId;
    public static String app_id = "";

    @Value("${merchantprivatekey}")
    private String merchantprivatekey;
    public static String merchant_private_key = "";

    @Value("${alipaypublickey}")
    private String alipaypublickey;
    public static String alipay_public_key = "";

    @Value("${notifyurl}")
    private String notifyurl;
    public static String notify_url = "";

    @Value("${returnurl}")
    private String returnurl;
    public static String return_url = "";

    @Value(("${signtype}"))
    private String signtype;
    public static String sign_type = "";
    @Value("${charset}")
    private String charset1;
    public static String charset = "";

    @Value("${gatewayUrl}")
    private String gatewayUrl1;
    public static String gatewayUrl = "";

    @Override
    public void afterPropertiesSet() throws Exception {
        AlipayConfig.app_id = appId;
        AlipayConfig.merchant_private_key = merchantprivatekey;
        AlipayConfig.alipay_public_key = alipaypublickey;
        AlipayConfig.notify_url = notifyurl;
        AlipayConfig.return_url = returnurl;
        AlipayConfig.sign_type = signtype;
        AlipayConfig.charset = charset1;
        AlipayConfig.gatewayUrl = gatewayUrl1;
    }
}
